package com.troll.wanandroid.application

import android.app.Application
import com.troll.eth.base.AppEx
import com.troll.eth.config.AppConfig
import com.troll.eth.ex.AppBar
import com.troll.eth.os.Dimension
import com.troll.wanandroid.R

class App : AppEx() {

    companion object {
        var application: Application? = null
    }


    override fun onCreate() {
        super.onCreate()
        application = this
    }

    override fun configureAppBar(): AppBar.Config = AppBar.Config.build {
        height = Dimension.Dp(AppBarVal.HEIGHT)
        icon {
            padding = Dimension.Dp(AppBarVal.ICON_PADDING)
            size = Dimension.Dp(AppBarVal.ICON_SIZE)
        }

        text {
            colorRes = R.color.nav_bar_text
            padding = Dimension.Dp(AppBarVal.TEXT_PADDING)
            size = Dimension.Dp(AppBarVal.TEXT_SIZE)
            focusBgDrawableRes = R.drawable.nav_bar_shape_focus
        }

//        bgColorRes = R.color.nav_bar_bg
//        focusBgDrawableRes = R.drawable.selector_bg_nav_bar_focus

        shape = AppBar.Config.Shape.INSIDE
    }

    override fun configureApp(): AppConfig = AppConfig.build {
        enableFlatBar = true
    }

}

internal object AppBarVal {
    const val HEIGHT = 48
    const val ICON_SIZE = 27
    const val ICON_PADDING = 0
    const val TEXT_SIZE = 18
    const val TEXT_PADDING = 12
}